feat: support extracting package groups from v2+ poetry.lock
files
#1477
+305
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Poetry v2 lockfiles now include the groups a package belongs to, meaning that we can support extracting them to allow filtering.
Similar to Maven and NPM, Poetry explicitly notes everything that isn't in an explicit group as being in the
main
group meaning for packages that are considered in that group we always use an empty slice instead since that's how we indicate the "production" group.I generated the final fixture using the following
pyproject.toml
:Technically we don't need the
python_version
constraint onproto-plus
for this feature, but I realised we don't have any existing fixtures for this situation so I figured I'd sneak it in as part of this given it seems like we already support the lockfile having a package multiple names with different versionsThis is a sister PR to google/osv-scalibr#376 since
osv-scanner
is still in the middle of transitioning to usingosv-scalibr
- the core logic is exactly the same, and either (or both) should be fine to land